﻿using System;
using System.Management.Automation;
using System.Runtime.InteropServices;
using Microsoft.SharePoint.PowerShell;

namespace CodeCounsel.SharePoint2010.DigiD.Cmdlets
{
    [SPCmdlet(RequireLocalFarmExist = true, RequireUserFarmAdmin = true)]
    [Cmdlet(VerbsCommon.Remove, "DigiDSettings")]
    public class RemoveDigiDSettingsCmdlet : SPRemoveCmdletBase<DigiDSettings>
    {
        [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)]
        public DigiDSettingsPipeBind Identity { get; set; }

        protected override void InternalValidate()
        {
            DataObject = Identity.Read();
            base.InternalValidate();
        }

        protected override void DeleteDataObject()
        {
            DataObject.Delete();
        }
    }
}
